package com.haiwei.poi.word.bean;

import com.alibaba.fastjson.JSONArray;
import com.haiwei.poi.word.exception.HaiweiBeanInvalidTypeException;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 列表 对象.
 * List<HaiweiObject>
 * Iterator
 *
 * @date: 2022-06-27
 * @version: 1.0
 * @author: karry@haiwei.com
 */
@Data
public class HaiweiObjectArray extends JSONArray {

    @Override
    public HaiweiObject get(int index) {
        final Object obj = super.get(index);
        if(obj instanceof  HaiweiObject){
            return (HaiweiObject)obj;
        }
        throw new HaiweiBeanInvalidTypeException("type invalided,type:" + obj.getClass().toGenericString());
    }
    
}
